<?php

namespace forfun\controller;

use forfun\controller\vo\AgreeForm;
use forfun\service\AgreeRecordService;
use restphp\http\RestHttpRequest;
use restphp\validate\RestValidate;

/**
 * @RequestMapping ("/api/v1/agree-records")
 */
class ApiAgreeRecordController
{
    /**
     * @Post ("")
     * @Logon
     * @return void
     */
    public function addAgree() {
        $agreeForm = RestHttpRequest::getBody(AgreeForm::class, true);
        AgreeRecordService::addAgree($agreeForm);
    }

    /**
     * @Delete ("")
     * @Logon
     * @return void
     */
    public function deleteAgree()
    {
        $agreeForm = RestHttpRequest::getParameterAsObject(AgreeForm::class, new AgreeForm());
        RestValidate::execute($agreeForm);
        AgreeRecordService::deleteAgree($agreeForm);
    }
}